<html>
<head><meta charset="utf-8"><title>Tree Based HIR · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html">Tree Based HIR</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="243560600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243560600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243560600">(Jun 22 2021 at 18:38)</a>:</h4>
<p>Started design doc for our new hir: <a href="https://hackmd.io/@matklad/rJzQhvk2u/edit">https://hackmd.io/@matklad/rJzQhvk2u/edit</a>!</p>



<a name="243840686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243840686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243840686">(Jun 24 2021 at 20:19)</a>:</h4>
<p>Working on this right now, good chance for some sync questions!</p>



<a name="243841660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243841660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243841660">(Jun 24 2021 at 20:27)</a>:</h4>
<p>Two question I just thought of:</p>
<ul>
<li>Will hir nodes always have a corresponding source node?</li>
<li>Somewhat related, can we synthesize hir nodes from thin air? For example for creating a pattern from a struct definition, or will this only every be available to the AST. I believe having this might be useful though I don't quite remember where I had the thought for this</li>
</ul>



<a name="243842352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243842352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243842352">(Jun 24 2021 at 20:33)</a>:</h4>
<p>Good questions.</p>
<p>I think the answer to the first is no -- we should support rlibs</p>
<p>The answer to the second one is I think also no -- full-fidelity with the source seem an important constraint to me. So,eg, we'll have the same tuple struct in both types and values namespace, instead of synthesizing a functin</p>



<a name="243842721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243842721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243842721">(Jun 24 2021 at 20:35)</a>:</h4>
<p>Ie, I think even if its convenient to introduce synthetics, it should be done after this layer</p>



<a name="243844584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243844584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243844584">(Jun 24 2021 at 20:50)</a>:</h4>
<p>Question -- what actually is the relation between tokens in macro expansion and macro invocation?</p>



<a name="243844640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243844640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243844640">(Jun 24 2021 at 20:50)</a>:</h4>
<p>For mbe, we track which source tokens go to which destination tokens.</p>



<a name="243844889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243844889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243844889">(Jun 24 2021 at 20:52)</a>:</h4>
<p>But proc macros can manufacture arbitrary spans -- what does it mean for the programming model?</p>
<p>Ie, <code>m!(foo)</code> expands to <code>bar</code>, where <code>bar</code> has the span of <code>foo</code>. Does it mean that <code>foo</code>s expansion is <code>bar</code>?</p>



<a name="243845459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243845459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243845459">(Jun 24 2021 at 20:56)</a>:</h4>
<p>I think that's what <em>should</em> happen, yeah. I don't know if we implement this correctly though.</p>



<a name="243845495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243845495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243845495">(Jun 24 2021 at 20:56)</a>:</h4>
<p>I'd say yes, <code>foo</code>'s expansion should be <code>bar</code> in that case. at least I can't think of a case where this would be odd, except maybe if the span of <code>foo</code> is used multiple times in different contexts. Would that be problematic?</p>



<a name="243845721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243845721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243845721">(Jun 24 2021 at 20:58)</a>:</h4>
<p>That's something we already have to anticipate with MBE</p>



<a name="243845776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243845776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243845776">(Jun 24 2021 at 20:59)</a>:</h4>
<p>You could paste a <code>$x:ident</code> multiple times in different contexts</p>



<a name="243845859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243845859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243845859">(Jun 24 2021 at 20:59)</a>:</h4>
<p>Right thats already a thing in MBE, I assume we just map that token to the first placement in the expansion then?</p>



<a name="243845975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243845975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243845975">(Jun 24 2021 at 21:00)</a>:</h4>
<p>I also wonder what happens when <code>foo</code> gets expanded to <code>&amp;</code> or some such. I am starting to think that, for procedural macros, there's just no fundamental "correct" link up between source and expansion?</p>



<a name="243846205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243846205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243846205">(Jun 24 2021 at 21:02)</a>:</h4>
<p>Could we verify that the input token kind gets mapped to the same output token kind maybe? As in only if an ident gets mapped to an ident we treat it as a proper mapping and otherwise not treat it as a correct mapping? Or would that break somewhere?</p>



<a name="243846250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243846250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243846250">(Jun 24 2021 at 21:02)</a>:</h4>
<p>Ie, that the thinking that a token "expands" to something is just flawed? </p>
<p>Rather, it might so happen that span of the original token and expansion is the same. So it's not <code>t -&gt; t'</code> but rather <code>t -&gt; s1</code>, <code>t' -&gt; s2</code>, and we are doing a JOIN on the spans?</p>



<a name="243848021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243848021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243848021">(Jun 24 2021 at 21:16)</a>:</h4>
<p>Currently it looks like we do indeed just assume that the first matching token is the only one:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="fm">macro_rules!</span><span class="w"> </span><span class="n">m</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="p">(</span><span class="cp">$x</span>:<span class="nc">ident</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="cp">$x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="cp">$x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="p">};</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">f</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">m</span><span class="o">!</span><span class="p">(</span><span class="n">asdf</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>Hovering over <code>asdf</code> says that it has type <code>i32</code>.</p>



<a name="243848064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243848064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243848064">(Jun 24 2021 at 21:17)</a>:</h4>
<p>Ah, this is also just how <code>TokenMap</code> lookup works, it just gives you the first token with the requested <code>TokenId</code></p>



<a name="243848133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243848133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243848133">(Jun 24 2021 at 21:17)</a>:</h4>
<p>How would one even write an IDE for this language? <span aria-label="rofl" class="emoji emoji-1f923" role="img" title="rofl">:rofl:</span></p>



<a name="243848287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243848287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243848287">(Jun 24 2021 at 21:19)</a>:</h4>
<p>It seems that the only "fundamental" property of expansion is actually just hygiene. token matching seems to be fundamentally heuristic...  I guess, I'll go and read <a href="https://rustc-dev-guide.rust-lang.org/macro-expansion.html">https://rustc-dev-guide.rust-lang.org/macro-expansion.html</a></p>



<a name="243848972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243848972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243848972">(Jun 24 2021 at 21:26)</a>:</h4>
<p>Ye I mean we cant really map tokens as soon as they appear in multiple different context, at least I dont see how/how we'd consume such a "multimapping"</p>



<a name="243850443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243850443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243850443">(Jun 24 2021 at 21:42)</a>:</h4>
<p>I mean, it should still work reliably as long as it's a one-to-one mapping, which is common</p>



<a name="243850513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243850513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243850513">(Jun 24 2021 at 21:42)</a>:</h4>
<p>Or at least as long as all positions in the output have the same "property"</p>



<a name="243851000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243851000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243851000">(Jun 24 2021 at 21:46)</a>:</h4>
<p>Ye certainly, I just wonder if we can do anything when have a one to many relation</p>



<a name="243851219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243851219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243851219">(Jun 24 2021 at 21:48)</a>:</h4>
<p>Uhh… one thing I want for hir 2.0 is to clearly separate “we know” from “we are guessing”. It seems like various “descend into macros” things should go into “guessing” section (</p>



<a name="243851391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243851391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243851391">(Jun 24 2021 at 21:50)</a>:</h4>
<p>In that example you could show two hovers...</p>



<a name="243851415"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243851415" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243851415">(Jun 24 2021 at 21:50)</a>:</h4>
<p>that would work too, yeah</p>



<a name="243851447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243851447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243851447">(Jun 24 2021 at 21:51)</a>:</h4>
<p>Not for everything though, what about semantic highlighting for example. We have to decide in that case</p>



<a name="243851455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243851455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243851455">(Jun 24 2021 at 21:51)</a>:</h4>
<p>well until we run into a macro that expands to thousands of uses of the same input identifier</p>



<a name="243851853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243851853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243851853">(Jun 24 2021 at 21:56)</a>:</h4>
<p><span class="user-mention silent" data-user-id="300586">Lukas Wirth</span> <a href="#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Tree.20Based.20HIR/near/243851447">said</a>:</p>
<blockquote>
<p>Not for everything though, what about semantic highlighting for example. We have to decide in that case</p>
</blockquote>
<p>Though we also got a similar problem with imports already where an import ident can refer up to 3 different items</p>



<a name="243885272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/243885272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#243885272">(Jun 25 2021 at 07:50)</a>:</h4>
<p>Wrote down my yesterday's revelation about macros in a more coherent form: <a href="https://github.com/rust-analyzer/rust-analyzer/issues/9403">https://github.com/rust-analyzer/rust-analyzer/issues/9403</a></p>



<a name="244870630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244870630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244870630">(Jul 04 2021 at 18:11)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink  [he/him]</span> expanded the macro issue a bit here: <a href="https://github.com/rust-analyzer/rust-analyzer/issues/9403#issuecomment-873635676">https://github.com/rust-analyzer/rust-analyzer/issues/9403#issuecomment-873635676</a>, curious what you think</p>



<a name="244870688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244870688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244870688">(Jul 04 2021 at 18:12)</a>:</h4>
<p>yeah the <code>Span::join</code> example also came to mind here</p>



<a name="244870691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244870691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244870691">(Jul 04 2021 at 18:13)</a>:</h4>
<p>interesting</p>



<a name="244870697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244870697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244870697">(Jul 04 2021 at 18:13)</a>:</h4>
<p>and in the rustc model, spans are also what carry hygiene and edition information</p>



<a name="244870745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244870745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244870745">(Jul 04 2021 at 18:14)</a>:</h4>
<p>(what happens if you join 2 spans with different editions?)</p>



<a name="244872836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244872836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244872836">(Jul 04 2021 at 19:07)</a>:</h4>
<p><span class="user-mention silent" data-user-id="211727">Jonas Schievink  [he/him]</span> <a href="#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Tree.20Based.20HIR/near/244870745">said</a>:</p>
<blockquote>
<p>(what happens if you join 2 spans with different editions?)</p>
</blockquote>
<p>The docs say that the two spans need to come from the same file</p>



<a name="244874873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244874873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244874873">(Jul 04 2021 at 19:59)</a>:</h4>
<p><span class="user-mention" data-user-id="211727">@Jonas Schievink  [he/him]</span> source location and hygiene are completely orthogonal bits in span. Span is a bit a misnomer, it couldve been type TokenData = (Span, Hygiene)</p>



<a name="244874894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244874894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244874894">(Jul 04 2021 at 20:00)</a>:</h4>
<p><span class="user-mention" data-user-id="203546">@Laurențiu</span> I think you can have spans from the same file but with different hygiene info.</p>



<a name="244875028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244875028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244875028">(Jul 04 2021 at 20:02)</a>:</h4>
<p>proc_macro exposes this to user code though (eg. via <a href="https://doc.rust-lang.org/proc_macro/struct.Span.html#method.mixed_site"><code>Span::mixed_site</code></a>)</p>



<a name="244875039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244875039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244875039">(Jul 04 2021 at 20:03)</a>:</h4>
<p>which isn't really that important, I was mostly mentioning that because it plays into how we want to handle this (since we should be having proper Hygiene support at some point)</p>



<a name="244875429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244875429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244875429">(Jul 04 2021 at 20:12)</a>:</h4>
<p>I think the fact that rustc doesn't have the recursive mapping approach that we have might be a red herring – this might have just been convenient for them since they have a global <code>SourceMap</code></p>



<a name="244875437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244875437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244875437">(Jul 04 2021 at 20:12)</a>:</h4>
<p>mixed_site just uses call site for the source location. It’s hygiene is semi-transparent, yeah, but hygiene and source info are still orthogonal.</p>



<a name="244875448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244875448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244875448">(Jul 04 2021 at 20:13)</a>:</h4>
<p>yeah</p>



<a name="244875595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244875595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244875595">(Jul 04 2021 at 20:16)</a>:</h4>
<p>Note that you sort of still have recursive mapping: you can look at the tokens of first-level expansion and note their spans. </p>
<p>Put it another way, you can pick a token in the original file, and file all the tokens from all he levels of expansion that have the same source span.</p>
<p>There is fundamental thing though: source map is a concatenated, byte-addressable list of sources. It only includes sources of original files. Macro expansions do not go into source map, if you ask for a snippet of some span from some expansion, you get the snippet of the original source code</p>



<a name="244875597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244875597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244875597">(Jul 04 2021 at 20:16)</a>:</h4>
<p>Let me actually verify that…</p>



<a name="244875848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244875848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244875848">(Jul 04 2021 at 20:23)</a>:</h4>
<p>ah, I see what you mean now</p>



<a name="244875915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244875915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244875915">(Jul 04 2021 at 20:24)</a>:</h4>
<p>it'll be interesting to figure out a way to store all these spans, rustc has a rather elaborate interning scheme</p>



<a name="244876000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244876000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244876000">(Jul 04 2021 at 20:27)</a>:</h4>
<p>Yeah, I've been reading the "compact data structures" book recently, it makes thinking about rust-analyzer's data srtuctures painful :)</p>



<a name="244876003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244876003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244876003">(Jul 04 2021 at 20:27)</a>:</h4>
<p>heh, that sounds like what we need a lot more of indeed</p>



<a name="244876728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244876728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244876728">(Jul 04 2021 at 20:45)</a>:</h4>
<p>Another useful example to think about is <code>concat!</code> / <code>concat_idents!</code> macro. It produces the token, whose source span is the span of the macro invocation, and the text of the token doesn't match anything we have in the SourceMap</p>



<a name="244876902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244876902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244876902">(Jul 04 2021 at 20:49)</a>:</h4>
<p>right, not when the SourceMap only contains actual file system files</p>



<a name="244878674"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244878674" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244878674">(Jul 04 2021 at 21:35)</a>:</h4>
<p>Made some progress on <a href="https://hackmd.io/ytd82QNiT_Ku2XFr1EAtiQ">https://hackmd.io/ytd82QNiT_Ku2XFr1EAtiQ</a> ! It seems that there are three kinds of files:</p>
<ul>
<li>Text Source files on disk / in vfs</li>
<li>Text Files as they are mounted into the crates</li>
<li>Token "Files" which are result of macro expansion</li>
</ul>



<a name="244879700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244879700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244879700">(Jul 04 2021 at 22:01)</a>:</h4>
<p>and eventually also highlighting injections, presumably?</p>



<a name="244879947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/244879947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#244879947">(Jul 04 2021 at 22:06)</a>:</h4>
<p>Argh, injections are hard… I would think that they need to be part of the <em>speculative</em> layer. Probably makes sense to move this to a separate bullet point in Semantic Constraints. <span class="user-mention" data-user-id="211727">@Jonas Schievink  [he/him]</span> feel free to (or not to) do this, I am away from keyboard</p>



<a name="245083899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/245083899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#245083899">(Jul 06 2021 at 19:00)</a>:</h4>
<p>I find that I feel really confilicted about what I want hir2.0 to be:</p>
<ul>
<li>we can try design it as <code>symbols + expanded AST</code></li>
<li>we can try designing it as just <code>expanded AST</code>, with a symbols layer being separate</li>
</ul>
<p>What is a <code>Module</code> is a question that separates two worlds. In symbols world, <code>Module</code> has just a scope with symbols. In expanded Ast world, module can be either inline, out of line, or root.</p>



<a name="245164276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/245164276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#245164276">(Jul 07 2021 at 11:23)</a>:</h4>
<p>Hmm. Not quite sure I see the distinction? I guess I would expect <code>Module</code> to have ways of getting to the declaration and definition where applicable, and to list the symbols defined in it. For me the harder question seems to be what to do about item-level macro calls</p>



<a name="245164395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/245164395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#245164395">(Jul 07 2021 at 11:25)</a>:</h4>
<p>maybe there need to be two methods, one that lists the items including macro calls that can then be recursed into, and one that just lists actual items</p>



<a name="246585341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/246585341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#246585341">(Jul 20 2021 at 13:42)</a>:</h4>
<p>Took another look at roslyn: they have two layer system of syntax and symbols. They don't have a special type layer, because symbols carry substitutions</p>



<a name="246585462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/246585462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#246585462">(Jul 20 2021 at 13:43)</a>:</h4>
<p>When you create  symbol form <code>struct S&lt;T&gt; (T)</code> syntax, the subst substs T for iteslf.  When you get the symbol from name resolution, <code>T</code> is substituted for the actual type argument.</p>



<a name="246585613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/246585613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#246585613">(Jul 20 2021 at 13:44)</a>:</h4>
<p><a href="https://docs.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.imethodsymbol.typearguments?view=roslyn-dotnet-3.10.0#Microsoft_CodeAnalysis_IMethodSymbol_TypeArguments">https://docs.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.imethodsymbol.typearguments?view=roslyn-dotnet-3.10.0#Microsoft_CodeAnalysis_IMethodSymbol_TypeArguments</a></p>



<a name="247083799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/247083799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#247083799">(Jul 24 2021 at 16:54)</a>:</h4>
<p>Bringing this up as it is HIR related, though maybe not related to the redesign. But we need to to somehow record imports in the HIR I believe, at least when they have renames to them or specific attributes like <code>#[doc(hidden)]</code>. Both of these things currently give us some problems in regards to renaming and completion we cannot currently solve.</p>



<a name="247083839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/247083839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lukas Wirth <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#247083839">(Jul 24 2021 at 16:55)</a>:</h4>
<p><a href="https://github.com/rust-analyzer/rust-analyzer/issues/5198">https://github.com/rust-analyzer/rust-analyzer/issues/5198</a>, <a href="https://github.com/rust-analyzer/rust-analyzer/issues/5671">https://github.com/rust-analyzer/rust-analyzer/issues/5671</a> regarding renames of aliases(which we currently just reject by checking whether the name we are renaming and the name of the definition are different)</p>
<p><a href="https://github.com/rust-analyzer/rust-analyzer/issues/9197">https://github.com/rust-analyzer/rust-analyzer/issues/9197</a> regarding <code>#[doc(hidden)]</code> messing up completions(this specific example also makes use of a rename which isnt really relevant to the core issue though)</p>



<a name="247084303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Tree%20Based%20HIR/near/247084303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Tree.20Based.20HIR.html#247084303">(Jul 24 2021 at 17:06)</a>:</h4>
<p>we also don't display docs on them</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>